# -*- mode: python -*-
#
# Copyright (C) 2016 Fred KONRAD <fred.konrad@greensocs.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.

##
# @ReadValue:
#
# The return value from a read command
#
# Since: 2.6
##
{ 'struct': 'ReadValue',
  'data': {'value': 'int'} }

##
# @read_mem:
#
# Read a memory location from a CPU point of view. The @qom name of the CPU is
# used if provided. The @cpu id is used if no @qom name are provided.
# If both the @qom name or @cpu id are not provided the access is done from cpu
# 0.
#
# @addr: The address to read.
# @size: The size of the access.
# @cpu: The optional index of the CPU doing the access.
# @qom: The optional qom name of the CPU doing the access.
#
# Returns: ReadValue, a strucutre with the value read
#
# Since 2.6
##
{ 'command': 'read_mem',
  'data': {'addr': 'int', 'size': 'int', '*cpu': 'int', '*qom': 'str'},
  'returns': 'ReadValue'}

##
# @write_mem:
#
# Write a memory location from a CPU point of view. The @qom name of the CPU is
# used if provided. The @cpu id is used if no @qom name are provided.
# If both the @qom name or @cpu id are not provided the access is done from cpu
# 0.
#
# @addr: The address to write.
# @val: The value which will be written.
# @size: The size of the access.
# @cpu: The optional index of the CPU doing the access.
# @qom: The optional qom name of the CPU doing the access.
#
# Returns: nothing in case of success
#
# Since 2.6
##
{ 'command': 'write_mem',
  'data': {'addr': 'int', 'val': 'int', 'size': 'int', '*cpu': 'int',
           '*qom': 'str', 'debug': 'bool'} }

##
# @trigger_event:
#
# Trigger an event
#
# @time_ns:  The event will be triggered at t + time_ns on the guest clock.
# @event_id: The ID of the event.
#
# Returns: nothing in case of success
#
# Since 2.6
##
{ 'command': 'trigger_event',
  'data': {'time_ns': 'int', 'event_id': 'int'} }

##
# @FAULT_EVENT:
#
# Emitted when a fault event is triggered
#
# @event_id: The id of the event which has been triggered
#
# Since: 2.6
##
{ 'event': 'FAULT_EVENT',
  'data': { 'event_id': 'int', 'time_ns': 'int'} }

##
# @inject_gpio:
#
# @device_name: Path to the device.
# @gpio:        Name of the GPIO will be unnamed-gpio if omitted.
# @num:         Number of the GPIO line.
# @val:         Value (boolean) to be set for the GPIO.
#
# Returns: nothing in case of success
#
# Since 2.6
##
{ 'command': 'inject_gpio',
  'data': {'device_name': 'str', '*gpio': 'str', 'num': 'int', 'val': 'int'} }

